package com.jeecg.p3.cmswx.web.back;

import org.apache.velocity.VelocityContext;
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
import org.jeecgframework.p3.core.utils.common.StringUtils;
import org.jeecgframework.p3.core.web.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * 描述：</b>JwWebJwidController<br>微信公众号字典表
 *
 * @author pituo
 * @since：2015年12月21日 16时33分45秒 星期一
 * @version:1.0
 */
@Controller
@RequestMapping("/cmswx/back/cmswx")
public class CmswxController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(CmswxController.class);


    /**
     * 列表页面
     *
     * @return
     */
    @RequestMapping(value = "list", method = {RequestMethod.GET, RequestMethod.POST})
    public void list(HttpServletResponse response, HttpServletRequest request,
                     @RequestParam(required = false, value = "pageNo", defaultValue = "1") int pageNo,
                     @RequestParam(required = false, value = "pageSize", defaultValue = "10") int pageSize) throws Exception {
        VelocityContext velocityContext = new VelocityContext();
        String viewName = "cmswx/back/myJwWebJwid-list.vm";
        try {
            String systemUserid = request.getSession().getAttribute("system_userid").toString();
            if (StringUtils.isEmpty(systemUserid)) {

            }
//            query.setCreateBy(systemUserid);
//            PageQuery<MyJwWebJwid> pageQuery = new PageQuery<MyJwWebJwid>();
//            pageQuery.setPageNo(pageNo);
//            pageQuery.setPageSize(pageSize);
//            String jwid = request.getSession().getAttribute("jwid").toString();
//            pageQuery.setQuery(query);
            velocityContext.put("jwid", 111);
            velocityContext.put("myJwWebJwid", 222);
            velocityContext.put("systemUserid", systemUserid);
            velocityContext.put("pageInfos", "");
        } catch (Exception e) {
            e.printStackTrace();
        }
        ViewVelocity.view(request, response, viewName, velocityContext);
    }

}
